//
//  ZJPublicUploadPhotoTableViewCell.m
//  ZJControlsClass
//
//  Created by apple on 2024/10/30.
//

#import "ZJPublicUploadPhotoTableViewCell.h"


@interface ZJPublicUploadPhotoTableViewCell ()

@property (nonatomic,strong) UIView * v;


@end


@implementation ZJPublicUploadPhotoTableViewCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        
        
        [self configUI];
        
    }
    return self;
}


-(void)configUI{
    
    [self.contentView addSubview:self.relabel];
    [self.contentView addSubview:self.titleLabel];
    [self.contentView addSubview:self.photoImg];
    [self.photoImg addSubview:self.addImg];
    [self.photoImg addSubview:self.uploadLabel];
    [self.contentView addSubview:self.v];
    
    [self.relabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).with.offset(ALIGN_HEIGHT_PT(0));
        make.left.equalTo(self.contentView).with.offset(ALIGN_WIDTH_PT(15));
        make.size.equalTo(@(CGSizeMake(10, 50)));
    }];
    
    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).with.offset(ALIGN_HEIGHT_PT(0));
        make.left.equalTo(self.relabel.mas_right);
        make.height.equalTo(@(ALIGN_HEIGHT_PT(50)));
        make.width.equalTo(@(SCREEN_WIDTH - ALIGN_WIDTH_PT(30)));
    }];
    
    [self.photoImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.titleLabel.mas_left);
        make.top.equalTo(self.titleLabel.mas_bottom).with.offset(ALIGN_HEIGHT_PT(5));
        make.size.equalTo(@(CGSizeMake(ALIGN_WIDTH_PT(120), ALIGN_HEIGHT_PT(75))));
    }];
    
    [self.addImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.photoImg).with.offset(ALIGN_HEIGHT_PT(16));
        make.centerX.equalTo(self.photoImg.mas_centerX);
        make.size.equalTo(@(CGSizeMake(ALIGN_WIDTH_PT(28), ALIGN_WIDTH_PT(28))));
    }];
    [self.uploadLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.photoImg.mas_centerX);
        make.top.equalTo(self.addImg.mas_bottom).with.offset(ALIGN_HEIGHT_PT(5));
    }];
    
    [self.v mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).with.offset(ALIGN_WIDTH_PT(15));
        make.right.equalTo(self.contentView).with.offset(-ALIGN_WIDTH_PT(15));
        make.bottom.equalTo(self.contentView.mas_bottom).with.offset(-ALIGN_HEIGHT_PT(0.5));
        make.height.equalTo(@(ALIGN_HEIGHT_PT(0.5)));
    }];
    
}



#pragma mark -- 点击事件
//-(void)respondsTo_upLoadPhotoImg{
//
//}

#pragma mark -- 懒加载

-(UILabel *)relabel{
    if (!_relabel) {
        _relabel = [UILabel new];
        _relabel.text = @"*";
        _relabel.textColor = [UIColor redColor];
        _relabel.font = FONT14;
        _relabel.textAlignment = NSTextAlignmentCenter;
    }
    return _relabel;
}


-(UILabel *)titleLabel{
    if (!_titleLabel) {
        _titleLabel = [UILabel new];
        _titleLabel.font = FONT14;
        _titleLabel.textColor = [UIColor blackColor];
        _titleLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _titleLabel;
}
-(UIImageView *)photoImg{
    if (!_photoImg) {
        _photoImg = [UIImageView new];
        _photoImg.layer.cornerRadius = 2;
        _photoImg.layer.masksToBounds = YES;
        _photoImg.layer.borderColor = COLOR_RGB(215, 216, 217).CGColor;
        _photoImg.layer.borderWidth = 0.5;
        _photoImg.contentMode = UIViewContentModeScaleAspectFit;
        
//        _photoImg.userInteractionEnabled = YES;
//        UITapGestureRecognizer * ges = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(respondsTo_upLoadPhotoImg)];
//        [_photoImg addGestureRecognizer:ges];
    }
    return _photoImg;
}

-(UIImageView *)addImg{
    if (!_addImg) {
        _addImg = [UIImageView new];
        _addImg.image = [UIImage imageNamed:@"上传"];
        _addImg.userInteractionEnabled = NO;
    }
    return _addImg;
}
-(UILabel *)uploadLabel{
    if (!_uploadLabel) {
        _uploadLabel = [UILabel new];
        _uploadLabel.text = @"上传营业执照";
        _uploadLabel.textColor = COLOR_RGB(68, 68, 68);
        _uploadLabel.textAlignment = NSTextAlignmentCenter;
        _uploadLabel.font = FONT11;
    }
    return _uploadLabel;
}


-(UIView *)v{
    if (!_v) {
        _v = [UIView new];
        _v.backgroundColor = COLOR_RGB(215, 216, 217);
    }
    return _v;
}

@end
